package com.tbq.game.service.http

import com.yanzhenjie.kalle.RequestMethod

object Http {
    inline fun <reified T> get( url: String, params: Map<String, Any>?, listener: OnHttpListener<T>) {
        BaseHttp.request( url, RequestMethod.GET, null, params, listener)
    }

    inline fun <reified T> post(url: String, params: Map<String, Any>?, listener: OnHttpListener<T>) {
        BaseHttp.request( url, RequestMethod.POST, null, params, listener)
    }

    inline fun <reified T> get(
        url: String,
        header: Map<String, String>?,
        params: Map<String, Any>?,
        listener: OnHttpListener<T>
    ) {
        BaseHttp.request( url, RequestMethod.GET, header, params, listener)
    }

    inline fun <reified T> put(
        url: String,
        header: Map<String, String>?,
        params: Map<String, Any>?,
        listener: OnHttpListener<T>
    ) {
        BaseHttp.request( url, RequestMethod.PUT, header, params, listener)
    }

    inline fun <reified T> delete(
        url: String,
        header: Map<String, String>?,
        params: Map<String, Any>?,
        listener: OnHttpListener<T>
    ) {
        BaseHttp.request( url, RequestMethod.DELETE, header, params, listener)
    }

    inline fun <reified T> post(
        url: String,
        header: Map<String, String>?,
        params: Map<String, Any>?,
        listener: OnHttpListener<T>
    ) {
        BaseHttp.request( url, RequestMethod.POST, header, params, listener)
    }
}